﻿using DG.Tweening;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class CustomButton : Button
{
    /// <summary>
    /// 点击变化按钮大小，结束还原
    /// </summary>
    private RectTransform m_RectTransform;
    [SerializeField]private float m_EndValue = 1.1f;
    
    private void Awake()
    {
        m_RectTransform = GetComponent<RectTransform>();
    }

    public override void OnPointerDown(PointerEventData eventData)
    {
        base.OnPointerDown(eventData);
        m_RectTransform.DOScale(m_EndValue,0.1f).SetEase(Ease.Linear);
    }

    public override void OnPointerUp(PointerEventData eventData)
    {
        base.OnPointerUp(eventData);
        m_RectTransform.DOScale(1f,0.1f).SetEase(Ease.Linear);
    }
    
}
